package pers.mihao.quickstream.account.repository.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import pers.mihao.quickstream.account.model.dto.PlatformDTO;
import pers.mihao.quickstream.account.repository.PlatformRepository;
import pers.mihao.quickstream.account.repository.convertor.AccountConvertor;
import pers.mihao.quickstream.account.repository.domain.PlatformDO;
import pers.mihao.quickstream.account.repository.mapper.PlatformMapper;
import pers.mihao.quickstream.common.util.Query;

import javax.annotation.Resource;

/**
 * @author mihao
 * @since 2024/11/24
 */
@Repository
public class PlatformRepositoryImpl implements PlatformRepository {

    @Resource
    PlatformMapper platformMapper;

    @Resource
    AccountConvertor accountConvertor;

    @Override
    public PlatformDTO queryByCode(String code) {
        PlatformDO platformCode = platformMapper.selectOne(new Query<PlatformDO>().eq("platformCode", code));
        return accountConvertor.map2PlatformDTO(platformCode);
    }
}
